package com.cal.utms.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.*;

import com.cal.utms.logAudit.AuditLogInt;
import com.cal.utms.util.ValueConvert;

import java.util.Date;

/**
 * The persistent class for the money_transaction database table.
 * 
 */
@Entity
@Table(name = "money_transaction")
@NamedQuery(name = "MoneyTransaction.findAll", query = "SELECT m FROM MoneyTransaction m")
public class MoneyTransaction implements Serializable, AuditLogInt {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "CREDIT_DEBIT")
	private String creditDebit;

	@Temporal(TemporalType.DATE)
	@Column(name = "DATE")
	private Date date;

	@Column(name = "TRAN_AMONT")
	private BigDecimal tranAmont;

	@Column(name = "TRAN_TO")
	private int tranTo;

	@Column(name = "TRAN_TYPE")
	private String tranType;

	@Column(name = "TRAN_TYPE_ID")
	private int tranTypeId;

	@ManyToOne
	@JoinColumn(name = "USER_ID")
	private User user;

	@ManyToOne
	@JoinColumn(name = "RELATED_FUND_ID")
	private Fund fund;

	@Column(name = "STATUS")
	private String status;

	@Temporal(TemporalType.DATE)
	@Column(name = "AFFECT_DATE")
	private Date effectDate;

	@Column(name = "CUSTOMER_TYPE")
	private String customerType;

	public MoneyTransaction() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCreditDebit() {
		return this.creditDebit;
	}

	public void setCreditDebit(String creditDebit) {
		this.creditDebit = creditDebit;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public BigDecimal getTranAmont() {
		return this.tranAmont;
	}

	public void setTranAmont(BigDecimal tranAmont) {
		this.tranAmont = tranAmont;
	}

	public int getTranTo() {
		return this.tranTo;
	}

	public void setTranTo(int tranTo) {
		this.tranTo = tranTo;
	}

	public String getTranType() {
		return this.tranType;
	}

	public void setTranType(String tranType) {
		this.tranType = tranType;
	}

	public int getTranTypeId() {
		return this.tranTypeId;
	}

	public void setTranTypeId(int tranTypeId) {
		this.tranTypeId = tranTypeId;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Fund getFund() {
		return fund;
	}

	public void setFund(Fund fund) {
		this.fund = fund;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getEffectDate() {
		return effectDate;
	}

	public void setEffectDate(Date effectDate) {
		this.effectDate = effectDate;
	}

	public String getCustomerType() {
		return customerType;
	}

	public void setCustomerType(String customerType) {
		this.customerType = customerType;
	}

	@Transient
	@Override
	public Long getLogId() {
		return ValueConvert.toLong(this.id);
	}

	@Transient
	@Override
	public String getLogDeatil() {
		StringBuilder sb = new StringBuilder();
		sb.append("Transaction Id : ").append(id);

		return sb.toString();
	}

}